import dt from '@dt/dt'
import leaderOpt from './leaderOpt.js'
import agentOpt from './agentOpt.js'
import dimissionOpt from './dimissionOpt.js'
import channelOpt from './channelOpt.js'
import relativeOpt from './relativeOpt.js'
import poolOpt from './poolOpt.js'
import salesOpt from './salesOpt.js'
import roomOpt from './roomOpt.js'

class Params {
  constructor(vm) {
    this.opts = []
    this.build()
  }
  
  leaderCreate() {
    return {
      key: 'leader',
      title: '组长设置',
      form: {
        labelWidth: 160,
        options: (_this) => {
          return leaderOpt.options(_this)
        }
      },
      help: leaderOpt.helps()
    }
  }
  
  agentCreate() {
    return {
      key: 'agent',
      title: '虚拟代理费率设置',
      form: {
        labelWidth: 155,
        options: (_this) => {
          return agentOpt.options(_this)
        }
      },
      table: {
        width: 650,
        listKey: 'boVirtualSettingList',
        columns: (_this) => {
          return agentOpt.columns(_this)
        }
      },
      help: agentOpt.helps()
    }
  }
  
  dimissionCreate() {
    return {
      key: 'dimission',
      title: '离职奖金设置',
      tips: '注：基数为总奖金，请填写离职、交接人所获所获占总奖金比例，若全不发放则全填0',
      table: {
        width: 500,
        listKey: 'boDimissionList',
        columns: (_this) => {
          return dimissionOpt.columns(_this)
        }
      },
      help: dimissionOpt.helps()
    }
  }
  
  channelCreate() {
    return {
      key: 'channel',
      title: '渠道成交奖金设置',
      form: {
        labelWidth: 135,
        options: (_this) => {
          return channelOpt.options(_this)
        }
      },
      table: {
        listKey: 'boChannelSettingList',
        columns: (_this) => {
          return channelOpt.columns(_this)
        }
      },
      help: channelOpt.helps()
    }
  }
  
  relativeCreate() {
    return {
      key: 'relative',
      title: '关系户成交奖金设置',
      form: {
        labelWidth: 145,
        options: (_this) => {
          return relativeOpt.options(_this)
        }
      },
      table: {
        width: 700,
        listKey: 'boAssociatesSettingList',
        columns: (_this) => {
          return relativeOpt.columns(_this)
        }
      },
      help: relativeOpt.helps()
    }
  }
  
  poolCreate() {
    return {
      key: 'pool',
      title: '奖金池设置',
      form: {
        labelWidth: 150,
        options: (_this) => {
          return poolOpt.options(_this)
        }
      },
      help: poolOpt.helps()
    }
  }
  
  salesCreate() {
    return {
      key: 'sales',
      title: '非顾问卖房奖金设置',
      form: {
        labelWidth: 175,
        options: (_this) => {
          return salesOpt.options(_this)
        }
      },
      table: {
        width: 750,
        listKey: 'boNoCounselorSellersSettingList',
        columns: (_this) => {
          return salesOpt.columns(_this)
        }
      },
      help: salesOpt.helps()
    }
  }
  
  roomCreate() {
    return {
      key: 'room',
      title: '非顾问房源确认规则',
      form: {
        labelWidth: 170,
        options: (_this) => {
          return roomOpt.options(_this)
        }
      },
      table: {
        width: 600,
        listKey: 'boNoCounselorRoomSettingList',
        columns: (_this) => {
          return roomOpt.columns(_this)
        }
      },
      help: roomOpt.helps()
    }
  }
  
  build() {
    this.opts.push(
      this.leaderCreate(),
      this.agentCreate(),
      this.dimissionCreate(),
      this.channelCreate(),
      this.relativeCreate(),
      this.poolCreate(),
      this.salesCreate(),
      this.roomCreate()
    )
  }
  
  options() {
    return this.opts
  }
}

export default Params